<!DOCTYPE html>
<html lang="zh-hans">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<title>安全中心</title>
<link rel="stylesheet" href="__TEMPLATE__/webfile/layer.css" id="layui_layer_skinlayercss">
<link rel="stylesheet" href="__TEMPLATE__/webfile/main.css">
<script src="__TEMPLATE__/sysme/js/jquery-1.9.1.min.js"></script>
<title>安全中心</title>
<script>
//时间函数：
//	setInterval(function(){
//		fnDate();
//	},1000);
	//js 获取当前时间
	function fnDate(){
	   var date=new Date();
	   var year=date.getFullYear();//当前年份
	   var month=date.getMonth();//当前月份
	   var data=date.getDate();//天
	   var hours=date.getHours();//小时
	   var minute=date.getMinutes();//分
	   var second=date.getSeconds();//秒
	   var time=year+"-"+fnW((month+1))+"-"+fnW(data)+" "+fnW(hours)+":"+fnW(minute)+":"+fnW(second);
	   $('#times').get(0).innerText=time;
	}
	//补位 当某个字段不是两位数时补0
	function fnW(str){
	   var num;
	   str>9?num=str:num="0"+str;
	   return num;
	}

</script>

</head>
<body cz-shortcut-listen="true">
<div class="header">
	<div class="main main_btm_border">
		<div class="left logo">
			<a href="{:url('index/home')}" class="logo-link" id=""><span class="logo_image"></span>
			<style>
.logo_image{background-image:url(__ATTACHMENT__/{$logo.logoimg})!important}
			</style>
			</a>
		</div>
		<div class="right login_and_userinfo_1">
			<div class="login_header">
				<span class="welcome"></span>
				<div class="mobile_download" style="cursor:pointer">
					<i class="iconfont"></i><i class="iconfont"></i><span class="">手机app下载</span>
				</div>
			</div>
		</div>
	</div>
</div>
<div id="model_2" class="model_2" style="display:none">
	<div class="model_header">
		<h1>温馨提醒</h1>
	</div>
	<div class="model_body">
		<span id="model_content"></span>
	</div>
	<div class="foot_succ">
		<a onclick="jQuery.modal.close()" class="btn btn-default btn-radius">确定</a>
	</div>
</div>
<div class="main usercenter">
	<div class="user_usersafe">
		<div class="user_menu left">
			<h2>会员中心</h2>
			<ul>
				<li class="hover"><i class="iconfont"></i><a href="{:url('user/index')}">个人中心</a></li>
				<li><i class="iconfont"></i><a class="user_goto_finance" href="{:url('user/recharge')}">财务中心</a></li>
				<li><i class="iconfont"></i><a href="{:url('user/callRecord')}">交易记录</a></li>
				<!-- 	<li><i class="iconfont"></i><a href="{:url('user/detail')}">详细设定</a></li> -->
				<li><i class="iconfont"></i><a href="{:url('user/peilvdetail')}">赔率详情</a></li>
				<li><i class="iconfont"></i><a href="{:url('user/message')}">信息公告</a></li>
				<li><i class="iconfont"></i><a href="{:url('user/djsm')}">等级说明</a></li>
				
			</ul>
			
			<h2>代理中心</h2>
			<ul>
				<li><i class="iconfont"></i><a class="user_goto_finance" href="{:url('user/dlCentent')}">代理说明</a></li>
				{if($f.dl==1)}
				<li><i class="iconfont"></i><a href="{:url('user/dailibaobiao')}">代理报表</a></li>
				<li><i class="iconfont"></i><a href="{:url('user/xiajibaobiao')}">下级报表</a></li> 
				<li><i class="iconfont"></i><a href="{:url('user/xiajikaihu')}">下级开户</a></li>
				<!--<li><i class="iconfont"></i><a href="{:url('user/xiajiguanli')}">下级管理</a></li>-->
				<li><i class="iconfont"></i><a href="{:url('user/touzhumingxi')}">投注明细</a></li>
				<li><i class="iconfont"></i><a href="{:url('user/jiaoyimingxi')}">交易明细</a></li>
				{else/}
				{if($open==1)}
				<li><i class="iconfont"></i><a href="{:url('user/shenqing')}">代理申请</a></li>{/if}
				{/if}
			</ul>
			
		</div>
		
		
		<div class="user_right right">
			<div class="usercenter_info">
				<div class="left">
					<div class="avatar left" id="photo" style="width:85px;height:85px;border-radius:50%;position:relative;background:url({if(empty($header))} '__TEMPLATE__/webfile/user_icon.png' {else/} '__UPLOADS__avatar/{$header}' {/if});background-size:100%;">
						<input type="file" style="opacity:0; filter:alpha(opacity=0); height: 85px; width: 85px; position: absolute; top: 0; left: 0; z-index: 9;" onchange="setFiles(this)" id="touxiang">
						<!--<img src="__TEMPLATE__/webfile/user_icon.png" alt="" class="avatar_img">-->
					</div>
					
					<div class="right user_info">
						<ul>
							<li><label for="username">用 户 名 :</label><span class="userinfo_username">{$user_all.username}</span><a style="margin-left:40px;font-size:14px;" href="{:url('processing/loginOut')}">退出</a></li>
					<!-- 	<li><label for="safe_lavel">安全等级:</label><i class="user_star start_light"></i><i class="user_star start_light"></i><i class="user_star start_light"></i><i class="user_star start_dark"></i><i class="user_star start_dark"></i></li> -->
							<li><label for="safa_lavel">平台等级:</label><span style="color:#E94335;">{$usnameclass.class_name}</span></li>

							

							
							<li>
								<a href="{:url('user/djsm')}">
								<label for="login_time" style="float:left;display:block;height:100%;line-height:18px;padding-right:0;color:#000;">等级信息：</label>
								{if(!empty($next_level))}
								<div style="font-size:12px;float:left;width:71%;color:#000;font-weight:normal;font-family:'微软雅黑';text-align: left;line-height:17px;">升级 <span style="color:#E94335;">{$next_level}</span>
									{if($next_money>0 || $next_xml>0 )}</br>
									还需
									{if( $next_money>0 )}<span>充值：{$next_money}元</span>&nbsp{/if}
									{if( $next_xml>0 )}<span>洗码：{$next_xml}元</span>{/if}
									{else/}
									已满足升级条件，下周一自动升级
									{/if}
								</div>
								{/if}
								</a>
							</li>

						</ul>
					</div>
				</div>
				<div class="right">
					<div class="account_info">
						<div class="account_balance">
							<label for="_balance">账户总额 :</label><em id="balance">{$user_all.je}</em><a href="javascript:;" id="refreshBalance" onclick="refreshMT()" style="margin-left:10px">刷新</a>
						</div>
						<div class="account_topup">
							<a class="btn btn-default topup-btn user_goto_recharge" href="{:url('User/recharge')}">充值</a><a class="btn btn-dark withdraw-btn user_goto_withdraw" href="{:url('User/drawMoney')}" style="background:#898989;">提现</a>
						</div>
					</div>
				</div>
			</div>
			<div class="user_main">
				<div class="user_header">
					<div class="user_header_nav">
						<ul>
							<li class="hover"><a href="{:url('user/index')}?us=i">安全中心</a></li>
							<li><a href="{:url('user/index')}?us=q">安全信息</a></li>
							<li><a href="{:url('user/index')}?us=r">个人资料</a></li>
						</ul>
					</div>
				</div>
				<div id="user_safe" class="user_body">
					<div class="safe_item">
						<div class="accordion-header">
							<div class="safe_item_head login_password pointer" id="set_up_o">
								<div class="left info_view">
									<i class="iconfont icon-mima1"></i>
									<div class="left">
										<h3>登录密码</h3>
										<span>定期更换密码，让您的账户更安全</span>
									</div>
								</div>
								<div class="right tool_control">
									<div class="tool_group" id="shezhi1">
										<i class="iconfont icon-duigou1"></i><span>已设置</span>
									</div>
									<div class="tool_group tool_change" id="xiugai">
										<span>修改</span>
									</div>
								</div>
							</div>
						</div>
						<div class="safe_item_body accordion-content" style="display:none" id="tanchu">
							<div class="change_password">
								<div class="form">
									<form id="changePwdFrom" autocomplete="off" action="{:url('User/updatePwd')}" method="post">
										<div class="form_group">
											<input type="password" placeholder="请输入旧密码" name="oldpass" id="oldpass" autocomplete="new-password">
										</div>
										<div class="form_group">
											<input type="password" placeholder="请输入新密码" name="pass" id="pass" autocomplete="new-password">
										</div>
										<div class="form_group">
											<input type="password" placeholder="请再次确认新密码" name="repass" id="repass" autocomplete="new-password">
										</div>
										<div class="form_remark">
											密码规则：密码长度至少 <span class="red">6</span> 位数
										</div>
										<input style="margin-left:32%;width:280px;" type="submit" class="btn btn-radius btn-default" name="button" id="changePwd" value="确认">
									</form>
								</div>
							</div>
						</div>
						<script>

						 $("#changePwd").click(function(){
							 var oldpass = document.getElementById("oldpass").value;
							 var newpass = document.getElementById("pass").value;
							 var newpass2 = document.getElementById("repass").value;
						
							 if(oldpass == ''){
								 alert('旧密码不能为空');
								 return false;
							 }else if(newpass == ''){
								 alert('新密码不能为空');
								 return false;
							 }else if(newpass2 == ''){
								 alert('请再次输入新密码');
								 return false;
							 }else if(newpass != newpass2){
								 alert('两次密码不一致！');
								 return false;
							 }
						
							$.ajax({
								type:"post",
								url:"/index/user/updatePwd",
								data:{"oldpass":oldpass,"pass":newpass,"repass":newpass2},
								dataType:"json",
								success: function (data){
									
									if(data == 1){
										alert('修改成功，重新登录');
										window.location.href = "{:url('index/index')}";
									}else{
										alert('填写信息不完整！');
										return false;
									}
								}
							});
						 });
						 </script>
					</div>
					<div class="safe_item" id="fund_password_item">
						<div class="accordion-header">
							<div class="safe_item_head login_password pointer"  id="set_up_t">
								<div class="left info_view">
									<i class="iconfont icon-iconfontcolor11"></i>
									<div class="left">
										<h3>资金密码</h3>
										<span>为您账户安全，真实姓名要与绑定银行卡姓名一致</span>
									</div>
								</div>
								<div class="right tool_control">
									<div class="tool_group" id="set_two">
									{if($res.bankren && $res.ejmm)}
										<i class="iconfont icon-duigou1"></i><span>已设置</span>
									{else /}
										<span class="red">未设置</span>
									{/if}
									</div>
									<div class="tool_group tool_change" id="shezhi2">
										<span>设置</span>
									</div>
								</div>
							</div>
						</div>
						<div class="safe_item_body accordion-content" style="display:none" id="fund_password_body">
							<div class="change_password">
								<div class="form" autocomplete="off">
								{if($res.ejmm)}
									<form id="changeTradePwdFrom" action="" method="post">
								{else/}
									<form id="changeTradePwdFrom" action="{:url('user/emdPwd')}" method="post">
								{/if}
										<div class="form_group">
											<input type="text" placeholder="请输入真实姓名" name="real_name" id="real_name" value="{$res.bankren}" {if($res.bankren && $res.ejmm)}readonly{/if}>
										</div>
										<div class="form_group">
											<input type="password" placeholder="{if condition='$res.ejmm'}请输入旧密码{else /}请设置资金密码{/if}" maxlength="6" name="pass" id="pass_now" onkeyup="value=value.replace(/[^\d]/g,'') " onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">
										</div>
										{if condition="$res.ejmm"}
										<div class="form_group">
											<input type="password" placeholder="请输入新密码" maxlength="6" name="pass_new" id="pass_new" onkeyup="value=value.replace(/[^\d]/g,'') " onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">
										</div>
										{/if}
										<div class="form_remark">
											密码规则： <span class="red">6位纯数字</span>
										</div>
										{if($res.ejmm)}
										<input type="submit" style="margin-left:32%;width:280px;" class="btn btn-radius btn-default" name="button" id="changeTradePwd" value="确认">
										{else/}
										<input type="submit" style="margin-left:32%;width:280px;" class="btn btn-radius btn-default" name="button" value="确认">
										{/if}
									</form>
								</div>
							</div>
						</div>
						<script>
						
						 $("#changeTradePwd").click(function(){
							 var real_name = document.getElementById("real_name").value;
							 var pass = document.getElementById("pass_now").value;
							 var pass_new = document.getElementById("pass_new").value;
							 if(real_name == ''){
								 alert('姓名不能为空');
								 return false;
							 }else if(pass == ''){
								 alert('旧密码不能为空');
								 return false;
							 }else if(pass_new == ''){
								 alert('新密码不能为空');
								 return false;
							 }else if(pass == pass_new){
								 alert('两次密码不能相同！');
								 return false;
							 }
						
							$.ajax({
								type:"post",
								url:"/index/user/emdPwd",
								data:{"real_name":real_name,"pass":pass,"pass_new":pass_new},
								dataType:"json",
								success: function (data){
									alert(data);
									
								}
							});
						 });
						 </script>
					</div>
					<div class="safe_item" id="bindBankHead">
						<div class="accordion-header">
							<div class="safe_item_head login_password pointer" id="set_up_h">
								<div class="left info_view">
									<i class="iconfont icon-icon01"></i>
									<div class="left">
										<h3>我的银行卡</h3>
										<span>为保证您的用卡安全，请绑定持卡人本人的银行卡</span>
									</div>
								</div>
								<div class="right tool_control">
									<div class="tool_group" id="set_three">
									{if condition="$res.bankno"}
										<i class="iconfont icon-duigou1" id="addBankCard"></i><span>已设置</span>
									{else /}
										<span class="red" id="addBankCard">去绑定</span>
									{/if}
									</div>
									<div class="tool_group tool_change" id="shezhi3">
										<span id="addBankCard">绑卡</span>
									</div>
								</div>
							</div>
						</div>
						<div class="safe_item_body accordion-content" style="display:none" id="add_bank_card_div">
							<div class="change_password">
								<div class="form">
									<form id="bindBankCardFrom" autocomplete="off" action="{:url('user/banksz')}" method="post">
										<div class="form_group disabled_group">
											<input type="text" name="bank_ren" placeholder="真实姓名" {if condition="$res.bankren"} value="{$res.bankren}" readonly{/if} id="real_name_2"><i onmousemove="show_info_window()" onmouseout="hide_info_window()" class="iconfont"></i>
											<div style="display:none" class="info_window">
											</div>
										</div>
										<div class="form_group">
											<select class="select select_k" name="bank_id" id="bank_id">
											{if($query.bankname)}
												<option value="{$res.bankname}" selected>{$query.bank}</option>
											{else/}
												<option value="0" selected>请选择开户行</option>
												{volist name="bank" id="item"}
												<option value="{$item.id}" {if condition="$res.bankname eq $item.id"}selected{/if}>{$item.bankname}</option>
												{/volist}
											{/if}
											</select>
										</div>
										<div class="form_group">
											<input type="text" placeholder="请输入银行卡号" name="bank_account" id="bank_account" value="{$query.bankno}" {if($query.bankno)}readonly{/if}>
										</div>
										<div class="form_group">
											<input type="text" placeholder="银行所在省份" name="bank_sf" value="{$query.banksf}" {if($query.banksf)}readonly{/if}>
										</div>
										<div class="form_group">
											<input type="text" placeholder="银行所在市区" name="bank_sq" value="{$query.banksq}" {if($query.banksq)}readonly{/if}>
										</div>
										<div class="form_group">
											<input type="text" placeholder="开户行具体地址" name="bank_address" value="{$query.bank_zhihang}" {if($query.bank_zhihang)}readonly{/if}>
										</div>
										{if(!$query.bankren && !$query.bankname && !$query.bankno)}
										<div class="form_group">
											<input type="password" placeholder="校验资金密码" name="pass" id="pass" autocomplete="new-password">
										</div>
										<input type="button" class="btn btn-radius btn-default" style="margin-left:32%;width:280px;" name="button" id="bindBankCard" value="确定" >
										{/if}
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
		var obj = document.querySelector("#photo");
		var file1 = document.querySelector("#touxiang");
		obj.addEventListener("click",fn1,false);
//		function fn(){
//			file1.click()
//		}
		file1.addEventListener("change",fn1,false);
		function fn1(){
			files = this.files[0];
			var Ofile = new FileReader();
			Ofile.readAsDataURL(files);
			Ofile.onload = function(){
				var self = this;
				$.ajax({
					type: "post",
					url: "/index/User/changeHeader",
					data:{img: this.result},
					success: function (data) {
						if( 1==parseInt(data) ){
							obj.style.background= 'url('+self.result+')';
							obj.style.backgroundSize= '100%';
						}else{
							layer.msg('上传失败');
						}
					},
					error:function(){
						layer.msg('上传失败');
					}
				});

			}
		}
		var files;
		var setFiles = function(element){
			files = element.files[0];
		};
function refreshMT() {
	$("#refreshBalance").text('刷新中...');
	$.ajax({
		type: "post",
		url: "/index/Processing/RefreshMoney",
		success: function (data) {
			if (data != "out") {
				$('#balance').html(data);
				$("#refreshBalance").text('刷新');
			}
		}
	});
}
$('#bindBankCard').click(function(){
	if($(this).val()=='提交中') return;
    $(this).val('提交中')
    $('#bindBankCardFrom').submit()
    setTimeout(function(){
    	$('#bindBankCard').val('确定')
    },2000)
})

$(document).ready(function(){
	  
	  $('#set_up_o').click(function(){
	  	$("#tanchu").slideToggle();
	  })
	});

$(document).ready(function(){
	 
	   $("#set_up_h").click(function(){
	    $("#add_bank_card_div").slideToggle();
	  });
	});

$(document).ready(function(){
	
	  $("#set_up_t").click(function(){
	    $("#fund_password_body").slideToggle();
	  });
	});	
</script>
</body>
</html>